/*Inheritance and overriding example.*/

object InheritanceExample {
	def main() : Unit = { 
		println((new test2()).realMain());
	}
}

class test2{

	def realMain() : String = {
		
		
		var obj1 : A;
		var obj2 : A;

		obj1 = new A();
		obj2 = new B();
		
		println(this.op(obj1,2,3));
		println(this.op(obj2,2,3));
		

		
		return "done";
	}

	def op( obj : A, a : Int, b : Int ) : Int = {
		
		return obj.operation(a,b);
	}

}

class B extends A {

	def operation(a : Int, b : Int) : Int = {
		println(bob);
		return a*b;
	}

}

class A {	
	var bob: String;
	
	def operation(a : Int, b : Int) : Int = {
		return a + b;
	} 

	def arfarf(): String  = {
		return "spongebob";
	}

}


